import request from '../utils/request';
import { getToken } from '../utils/user';
import { baseApi } from "../utils/request"
import axios from 'axios';

export const uploadFile = (file, data) => {
    console.log("upLoadfile", file);
    let param = new FormData();
    param.append('file', file.file);
    param.append("folder", data.folder ? data.folder : "");
    param.append("apiToken", getToken());
    let config = {
        header: { 'Content-Type': 'multipart/form-data' }
    }
    return axios.post(baseApi + 'uploadFile', param, config)
}

export const getMobileCode = query => {
    return request({
        url: '/get_mobile_code',
        method: 'get',
        params: query
    });
};

export const codeLogin = query => {
    return request({
        url: '/code',
        method: 'post',
        params: query
    });
};

export const getWxId = query => {
    return request({
        url: '/wx_login',
        method: 'get',
        params: query
    });
};

export const addOrgWx = query => {
    return request({
        url: '/add_org_wx',
        method: 'post',
        params: query
    });
};


export const getOrg = query => {
    return request({
        url: '/get_org',
        method: 'get',
        params: query
    });
};

export const getOrders = query => {
    return request({
        url: '/get_orders',
        method: 'get',
        params: query
    });
};

export const getOrderDetail = query => {
    return request({
        url: '/get_order_detail',
        method: 'get',
        params: query
    });
};

export const editPrice = query => {
    return request({
        url: '/edit_price',
        method: 'post',
        params: query
    });
};

export const updateOrderReport = query => {
    return request({
        url: '/update_order_report',
        method: 'post',
        params: query
    });
};

export const updateOrderCode = query => {
    return request({
        url: '/update_order_code',
        method: 'post',
        params: query
    });
};


export const getItemCate = query => {
    return request({
        url: '/get_item_cate',
        method: 'get',
        params: query
    });
};

export const editItemCate = query => {
    return request({
        url: '/edit_item_cate',
        method: 'post',
        params: query
    });
};
export const addItemCate = query => {
    return request({
        url: '/add_item_cate',
        method: 'post',
        params: query
    });
};


export const getItem = query => {
    return request({
        url: '/get_item',
        method: 'get',
        params: query
    });
};

export const editItem = query => {
    return request({
        url: '/edit_item',
        method: 'post',
        params: query
    });
};
export const addItem = query => {
    return request({
        url: '/add_item',
        method: 'post',
        params: query
    });
};


export const getItemDetail = query => {
    return request({
        url: '/get_item_detail',
        method: 'get',
        params: query
    });
};


export const getDoc = query => {
    return request({
        url: '/get_doc',
        method: 'get',
        params: query
    });
};

export const getPatient = query => {
    return request({
        url: '/get_patient',
        method: 'get',
        params: query
    });
};

export const checkPatientBd = query => {
    return request({
        url: '/check_patient_bd',
        method: 'post',
        params: query
    });
};


export const patientBd = query => {
    return request({
        url: '/patient_bd',
        method: 'post',
        params: query
    });
};


export const doctorRegister = query => {
    return request({
        url: '/doctor_register',
        method: 'post',
        params: query
    });
};


export const createOrder = query => {
    return request({
        url: '/create_order',
        method: 'post',
        params: query
    });
};

